package com.jintoufs.dao.security.impl;

import com.jintoufs.dao.MyBatisSupport;
import com.jintoufs.dao.security.ResourceDAO;
import com.jintoufs.domain.security.Resource;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository("resourceDAO")
public class ResourceDAOImpl extends MyBatisSupport<ResourceDAO, Resource> implements ResourceDAO {

    @Override
    public void insert(Resource resource) {
        getMapper().insert(resource);

    }

    @Override
    public void update(Resource resource) {
        getMapper().update(resource);
    }

    @Override
    public List<Resource> selectByParams(Map<String, Object> params) {
        return getMapper().selectByParams(params);
    }

    @Override
    public List<Resource> selectAll() {
        return getMapper().selectAll();
    }

    @Override
    public List<Resource> selectByRole(Integer roleId) {
        return getMapper().selectByRole(roleId);
    }

    @Override
    public Resource selectById(Integer id) {
        return getMapper().selectById(id);
    }

    @Override
    public void delete(Integer id) {
        getMapper().delete(id);

    }

    @Override
    public void saveRoleResource(Integer roleId, Integer resourceId) {
        getMapper().saveRoleResource(roleId, resourceId);
    }

    @Override
    public void deleteResourceByRole(Integer roleId) {
        getMapper().deleteResourceByRole(roleId);
    }

    @Override
    public void deleteResourceById(Integer id) {
        getMapper().deleteResourceById(id);
    }

    @Override
    public boolean isMenu(Map<String, Object> params) {
        return getMapper().isMenu(params);
    }

}
